package com.neusoft.resturant.service.impl;

import com.neusoft.resturant.common.utils.DateUtils;
import com.neusoft.resturant.entity.ResComment;
import com.neusoft.resturant.mapper.ResCommentMapper;
import com.neusoft.resturant.service.IResCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 评论Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-10
 */
@Service
public class ResCommentServiceImpl implements IResCommentService
{
    @Autowired
    private ResCommentMapper resCommentMapper;

    /**
     * 查询评论
     * 
     * @param id 评论主键
     * @return 评论
     */
    @Override
    public ResComment selectResCommentById(Long id)
    {
        return resCommentMapper.selectResCommentById(id);
    }

    /**
     * 查询评论列表
     * 
     * @param resComment 评论
     * @return 评论
     */
    @Override
    public List<ResComment> selectResCommentList(ResComment resComment)
    {
        return resCommentMapper.selectResCommentList(resComment);
    }

    /**
     * 新增评论
     * 
     * @param resComment 评论
     * @return 结果
     */
    @Override
    public int insertResComment(ResComment resComment)
    {
        resComment.setCreateTime(DateUtils.getNowDate());
        return resCommentMapper.insertResComment(resComment);
    }

    /**
     * 修改评论
     * 
     * @param resComment 评论
     * @return 结果
     */
    @Override
    public int updateResComment(ResComment resComment)
    {
        resComment.setUpdateTime(DateUtils.getNowDate());
        return resCommentMapper.updateResComment(resComment);
    }

    /**
     * 批量删除评论
     * 
     * @param ids 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deleteResCommentByIds(Long[] ids)
    {
        return resCommentMapper.deleteResCommentByIds(ids);
    }

    /**
     * 删除评论信息
     * 
     * @param id 评论主键
     * @return 结果
     */
    @Override
    public int deleteResCommentById(Long id)
    {
        return resCommentMapper.deleteResCommentById(id);
    }
}
